package com.kuzlak.cms.module.wms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kuzlak.cms.module.wms.entity.WmsBound;
import com.kuzlak.cms.module.wms.service.WmsBoundService;
import com.kuzlak.cms.module.wms.mapper.WmsBoundMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【wms_bound(入库记录表)】的数据库操作Service实现
* @createDate 2024-12-15 22:48:16
*/
@Service
public class WmsBoundServiceImpl extends ServiceImpl<WmsBoundMapper, WmsBound>
    implements WmsBoundService{

    @Cacheable(cacheNames = "wms_bound", key = "'findByShopIdAndInfoId::'+#shopInfoId+'::infoId'+#infoId", unless = "#result == null")
    @Override
    public WmsBound findByShopIdAndInfoId(Long shopInfoId, Long infoId) {
        LambdaQueryWrapper<WmsBound> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WmsBound::getShopInfoId,shopInfoId);
        queryWrapper.eq(WmsBound::getInfoId,infoId);
        queryWrapper.last("limit 1");
        return this.getOne(queryWrapper);

    }
}




